<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>第九节：node环境搭建 | 微信小程序</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="gitbook/style.css">
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="./di-shi-jie-ff1a-yun-han-shu.html" />
    
    
    <link rel="prev" href="./di-ba-jie-ff1a-wen-jian-shang-chuan.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="6.9"
        data-chapter-title="第九节：node环境搭建"
        data-filepath="di-jiu-jie-ff1a-node-huan-jing-da-jian.md"
        data-basepath="."
        data-revision="Tue Feb 12 2019 17:48:38 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="./index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="chapter1.html">
            
                
                    <a href="./chapter1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        第一章：小程序前奏
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="chapter1/di-yi-jie-ff1a-ren-shi-xiao-cheng-xu.html">
            
                
                    <a href="./chapter1/di-yi-jie-ff1a-ren-shi-xiao-cheng-xu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        第一节：认识小程序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="chapter1/di-er-jie-ff1a-zhun-bei-gong-zuo.html">
            
                
                    <a href="./chapter1/di-er-jie-ff1a-zhun-bei-gong-zuo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        第二节：准备工作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="chapter1/di-san-jie-ff1a-kai-fa-gong-ju-jie-shao.html">
            
                
                    <a href="./chapter1/di-san-jie-ff1a-kai-fa-gong-ju-jie-shao.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        第三节：开发工具介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="chapter1/di-liu-jie-ff1a-wxss-yu-fa.html">
            
                
                    <a href="./chapter1/di-liu-jie-ff1a-wxss-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        第六节：WXSS语法
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo.html">
            
                
                    <a href="./di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        第二章：小程序基础
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-yi-jie-ff1a-kuang-jia-jie-shao.html">
            
                
                    <a href="./di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-yi-jie-ff1a-kuang-jia-jie-shao.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        第一节：项目结构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-er-jie-ff1a-wxml-yu-fa.html">
            
                
                    <a href="./di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-er-jie-ff1a-wxml-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        第二节：配置
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-san-jie-ff1a-wxml-yu-fa.html">
            
                
                    <a href="./di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-san-jie-ff1a-wxml-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        第三节：WXML语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-si-jie-ff1a-wxss-yu-fa.html">
            
                
                    <a href="./di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-si-jie-ff1a-wxss-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        第五节：事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-liu-jie-ff1a-wxss-yu-fa.html">
            
                
                    <a href="./di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-liu-jie-ff1a-wxss-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        第六节：WXSS语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-qi-jie-ff1a-flex-bu-ju.html">
            
                
                    <a href="./di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-qi-jie-ff1a-flex-bu-ju.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        第七节：flex布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-bajie-ff1a-app-sheng-ming-zhou-qi.html">
            
                
                    <a href="./di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-bajie-ff1a-app-sheng-ming-zhou-qi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        第八节：APP对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-jiu-jie-ff1a-page-dui-xiang.html">
            
                
                    <a href="./di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-jiu-jie-ff1a-page-dui-xiang.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        第九节：Page对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-shi-zhang-ff1a-wxs-yu-fa.html">
            
                
                    <a href="./di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-shi-zhang-ff1a-wxs-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        第十节：WXS语法
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="di-san-zhang-ff1a-chang-yong-zu-jian.html">
            
                
                    <a href="./di-san-zhang-ff1a-chang-yong-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        第三章：常用组件
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-yi-jie-ff1a-shi-tu-rong-qi-zu-jian.html">
            
                
                    <a href="./di-san-zhang-ff1a-chang-yong-zu-jian/di-yi-jie-ff1a-shi-tu-rong-qi-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        第一节：scroll-view组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-er-jieff1a-swiper-zu-jian.html">
            
                
                    <a href="./di-san-zhang-ff1a-chang-yong-zu-jian/di-er-jieff1a-swiper-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        第二节：swiper组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-san-jie-ff1a-movable-view-zu-jian.html">
            
                
                    <a href="./di-san-zhang-ff1a-chang-yong-zu-jian/di-san-jie-ff1a-movable-view-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        第三节：movable-view组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-sijie-ff1a-icon-zu-jian.html">
            
                
                    <a href="./di-san-zhang-ff1a-chang-yong-zu-jian/di-sijie-ff1a-icon-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        第四节：icon组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-wu-jie-ff1a-text-zu-jian.html">
            
                
                    <a href="./di-san-zhang-ff1a-chang-yong-zu-jian/di-wu-jie-ff1a-text-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        第五节：text组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-liu-jie-ff1a-input-zu-jian.html">
            
                
                    <a href="./di-san-zhang-ff1a-chang-yong-zu-jian/di-liu-jie-ff1a-input-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        第六节：input组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/zi-ding-yi-zu-jian.html">
            
                
                    <a href="./di-san-zhang-ff1a-chang-yong-zu-jian/zi-ding-yi-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        自定义组件
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" >
            
            <span><b>4.</b> 第四章：小程序API</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="di-yi-jie-ff1a-wang-luo-qing-qiu-api.html">
            
                
                    <a href="./di-yi-jie-ff1a-wang-luo-qing-qiu-api.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        第一节：网络请求API
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="di-liu-zhang-ff1a-es6-yu-fa.html">
            
                
                    <a href="./di-liu-zhang-ff1a-es6-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        第五章：ES6语法
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="di-liu-zhang-ff1a-es6-yu-fa/di-yi-jie-ff1a-shi-yao-shi-es6-yu-fa.html">
            
                
                    <a href="./di-liu-zhang-ff1a-es6-yu-fa/di-yi-jie-ff1a-shi-yao-shi-es6-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        第一节：什么是ES6语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="di-liu-zhang-ff1a-es6-yu-fa/di-er-jie-ff1a-es6-yu-fa.html">
            
                
                    <a href="./di-liu-zhang-ff1a-es6-yu-fa/di-er-jie-ff1a-es6-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        第二节：定义变量
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="di-liu-zhang-ff1a-es6-yu-fa/di-san-jie-ff1a-han-shu.html">
            
                
                    <a href="./di-liu-zhang-ff1a-es6-yu-fa/di-san-jie-ff1a-han-shu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        第三节：函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="di-liu-zhang-ff1a-es6-yu-fa/di-si-jie-ff1a-lei.html">
            
                
                    <a href="./di-liu-zhang-ff1a-es6-yu-fa/di-si-jie-ff1a-lei.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        第四节：类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="di-liu-zhang-ff1a-es6-yu-fa/di-wu-jie-ff1a-mo-kuai.html">
            
                
                    <a href="./di-liu-zhang-ff1a-es6-yu-fa/di-wu-jie-ff1a-mo-kuai.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        第五节：模块
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="di-wu-zhang-ff1a-yun-kai-fa.html">
            
                
                    <a href="./di-wu-zhang-ff1a-yun-kai-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        第六章：云开发
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="di-yi-jie-ff1a-shi-yao-shi-yun-kai-fa.html">
            
                
                    <a href="./di-yi-jie-ff1a-shi-yao-shi-yun-kai-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        第一节：什么是云开发
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="di-er-jie-ff1a-zhu-ce-wei-xin-xiao-cheng-xu.html">
            
                
                    <a href="./di-er-jie-ff1a-zhu-ce-wei-xin-xiao-cheng-xu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        第二节：注册微信小程序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="di-san-jie-ff1a-kai-tong-yun-kai-fa.html">
            
                
                    <a href="./di-san-jie-ff1a-kai-tong-yun-kai-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        第三节：开通云开发
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="di-si-jie-ff1a-shu-ju-ku.html">
            
                
                    <a href="./di-si-jie-ff1a-shu-ju-ku.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        第四节：数据库准备
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="di-wu-jie-ff1a-shu-ju-ku-cao-zuo.html">
            
                
                    <a href="./di-wu-jie-ff1a-shu-ju-ku-cao-zuo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.</b>
                        
                        第五节：数据库操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="di-liu-jie-ff1a-command-zhi-ling.html">
            
                
                    <a href="./di-liu-jie-ff1a-command-zhi-ling.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.</b>
                        
                        第六节：command指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.7" data-path="di-qi-jie-ff1a-gao-ji-cha-xun.html">
            
                
                    <a href="./di-qi-jie-ff1a-gao-ji-cha-xun.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.</b>
                        
                        第七节：高级查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.8" data-path="di-ba-jie-ff1a-wen-jian-shang-chuan.html">
            
                
                    <a href="./di-ba-jie-ff1a-wen-jian-shang-chuan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.8.</b>
                        
                        第八节：文件操作
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="6.9" data-path="di-jiu-jie-ff1a-node-huan-jing-da-jian.html">
            
                
                    <a href="./di-jiu-jie-ff1a-node-huan-jing-da-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.9.</b>
                        
                        第九节：node环境搭建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.10" data-path="di-shi-jie-ff1a-yun-han-shu.html">
            
                
                    <a href="./di-shi-jie-ff1a-yun-han-shu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.10.</b>
                        
                        第十节：云函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.11" data-path="di-shi-yi-jie-ff1a-yun-han-shu-jian-ce-nei-rong-an-quan.html">
            
                
                    <a href="./di-shi-yi-jie-ff1a-yun-han-shu-jian-ce-nei-rong-an-quan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.11.</b>
                        
                        第十一节：检测内容安全
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.12" data-path="di-shi-er-jie-ff1a-yun-han-shu-tu-pian-jian-huang.html">
            
                
                    <a href="./di-shi-er-jie-ff1a-yun-han-shu-tu-pian-jian-huang.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.12.</b>
                        
                        第十二节：图片鉴黄
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.13" data-path="di-shi-san-jie-ff1a-yong-hu-shou-quan.html">
            
                
                    <a href="./di-shi-san-jie-ff1a-yong-hu-shou-quan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.13.</b>
                        
                        第十三节：用户授权
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.14" data-path="di-shi-si-jie-ff1a-qi-ta-shou-quan-fang-shi.html">
            
                
                    <a href="./di-shi-si-jie-ff1a-qi-ta-shou-quan-fang-shi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.14.</b>
                        
                        第十四节：其他授权方式
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="./" >微信小程序</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="node&#x73AF;&#x5883;&#x642D;&#x5EFA;">node&#x73AF;&#x5883;&#x642D;&#x5EFA;</h1>
<p>&#x56E0;&#x4E3A;&#x4E91;&#x51FD;&#x6570;&#x5728;&#x670D;&#x52A1;&#x5668;&#x4E0A;&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x8FD0;&#x884C;&#x5728;<code>node.js</code>&#x73AF;&#x5883;&#x4E2D;&#x7684;&#xFF0C;&#x5E76;&#x4E14;&#x4E91;&#x51FD;&#x6570;&#x662F;&#x4E13;&#x95E8;&#x7528;&#x6765;&#x5904;&#x7406;&#x4E00;&#x4E9B;&#x903B;&#x8F91;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x96BE;&#x514D;&#x8981;&#x7528;&#x5230;&#x4E00;&#x4E9B;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;&#xFF0C;&#x800C;&#x4E91;&#x51FD;&#x6570;&#x5728;&#x7F16;&#x5199;&#x7684;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x662F;&#x9700;&#x8981;&#x5148;&#x5728;&#x672C;&#x5730;&#x5199;&#x597D;&#xFF0C;&#x7136;&#x540E;&#x518D;&#x8FDB;&#x884C;&#x63D0;&#x4EA4;&#x5230;&#x4E91;&#x670D;&#x52A1;&#x5668;&#x4E0A;&#x3002;&#x56E0;&#x6B64;&#x6211;&#x4EEC;&#x672C;&#x5730;&#x4E5F;&#x9700;&#x8981;&#x5B89;&#x88C5;&#x597D;&#x4E00;&#x5957;<code>node.js</code>&#x73AF;&#x5883;&#x3002;</p>
<h2 id="nvm&#x5B89;&#x88C5;&#xFF1A;">nvm&#x5B89;&#x88C5;&#xFF1A;</h2>
<p><code>nvm&#xFF08;Node Version Manager&#xFF09;</code>&#x662F;&#x4E00;&#x4E2A;&#x7528;&#x6765;&#x7BA1;&#x7406;<code>node</code>&#x7248;&#x672C;&#x7684;&#x5DE5;&#x5177;&#x3002;&#x6211;&#x4EEC;&#x4E4B;&#x6240;&#x4EE5;&#x9700;&#x8981;&#x4F7F;&#x7528;<code>node</code>&#xFF0C;&#x662F;&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x4F7F;&#x7528;<code>node</code>&#x4E2D;&#x7684;<code>npm(Node Package Manager)</code>&#xFF0C;&#x4F7F;&#x7528;<code>npm</code>&#x7684;&#x76EE;&#x7684;&#x662F;&#x4E3A;&#x4E86;&#x80FD;&#x591F;&#x65B9;&#x4FBF;&#x7684;&#x7BA1;&#x7406;&#x4E00;&#x4E9B;&#x524D;&#x7AEF;&#x5F00;&#x53D1;&#x7684;&#x5305;&#xFF01;<code>nvm</code>&#x7684;&#x5B89;&#x88C5;&#x975E;&#x5E38;&#x7B80;&#x5355;&#xFF0C;&#x6B65;&#x9AA4;&#x5982;&#x4E0B;&#xFF1A;  </p>
<ol>
<li>&#x5230;&#x8FD9;&#x4E2A;&#x94FE;&#x63A5;&#x4E0B;&#x8F7D;<code>nvm</code>&#x7684;&#x5B89;&#x88C5;&#x5305;&#xFF1A;<code>https://github.com/coreybutler/nvm-windows/releases</code>&#x3002;  </li>
<li>&#x7136;&#x540E;&#x70B9;&#x51FB;&#x4E00;&#x987F;&#x4E0B;&#x4E00;&#x6B65;&#xFF0C;&#x5B89;&#x88C5;&#x5373;&#x53EF;&#xFF01;  </li>
<li>&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x540E;&#xFF0C;&#x8FD8;&#x9700;&#x8981;&#x914D;&#x7F6E;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x3002;&#x5728;<code>&#x6211;&#x7684;&#x7535;&#x8111;-&gt;&#x5C5E;&#x6027;-&gt;&#x9AD8;&#x7EA7;&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E;-&gt;&#x73AF;&#x5883;&#x53D8;&#x91CF;-&gt;&#x7CFB;&#x7EDF;&#x73AF;&#x5883;&#x53D8;&#x91CF;-&gt;Path</code>&#x4E0B;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;&#xFF0C;&#x628A;<code>nvm</code>&#x6240;&#x5904;&#x7684;&#x8DEF;&#x5F84;&#x586B;&#x5165;&#x8FDB;&#x53BB;&#x5373;&#x53EF;&#xFF01;  </li>
<li>&#x6253;&#x5F00;<code>cmd</code>&#xFF0C;&#x7136;&#x540E;&#x8F93;&#x5165;<code>nvm</code>&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x63D0;&#x793A;&#x6CA1;&#x6709;&#x627E;&#x4E0D;&#x5230;&#x8FD9;&#x4E2A;&#x547D;&#x4EE4;&#x3002;&#x8BF4;&#x660E;&#x5DF2;&#x7ECF;&#x5B89;&#x88C5;&#x6210;&#x529F;&#xFF01;  </li>
<li><code>Mac</code>&#x6216;&#x8005;<code>Linux</code>&#x5B89;&#x88C5;<code>nvm</code>&#x8BF7;&#x770B;&#x8FD9;&#x91CC;&#xFF1A;<code>https://github.com/creationix/nvm</code>&#x3002;&#x4E5F;&#x8981;&#x8BB0;&#x5F97;&#x914D;&#x7F6E;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x3002;</li>
</ol>
<p><code>nvm</code>&#x5E38;&#x7528;&#x547D;&#x4EE4;&#xFF1A;  </p>
<ol>
<li><code>nvm install latest</code>&#xFF1A;&#x5B89;&#x88C5;&#x6700;&#x65B0;&#x7248;&#x7684;<code>node.js</code>&#x3002;nvm i == nvm install&#x3002;  </li>
<li><code>nvm install [version]</code>&#xFF1A;&#x5B89;&#x88C5;&#x6307;&#x5B9A;&#x7248;&#x672C;&#x7684;<code>node.js</code> &#x3002;  </li>
<li><code>nvm use [version]</code>&#xFF1A;&#x4F7F;&#x7528;&#x67D0;&#x4E2A;&#x7248;&#x672C;&#x7684;<code>node</code>&#x3002;  </li>
<li><code>nvm list</code>&#xFF1A;&#x5217;&#x51FA;&#x5F53;&#x524D;&#x5B89;&#x88C5;&#x4E86;&#x54EA;&#x4E9B;&#x7248;&#x672C;&#x7684;<code>node</code>&#x3002;  </li>
<li><code>nvm uninstall [version]</code>&#xFF1A;&#x5378;&#x8F7D;&#x6307;&#x5B9A;&#x7248;&#x672C;&#x7684;<code>node</code>&#x3002;  </li>
<li><code>nvm node_mirror [url]</code>&#xFF1A;&#x8BBE;&#x7F6E;<code>nvm</code>&#x7684;&#x955C;&#x50CF;&#x3002;  </li>
<li><code>nvm npm_mirror [url]</code>&#xFF1A;&#x8BBE;&#x7F6E;<code>npm</code>&#x7684;&#x955C;&#x50CF;&#x3002;</li>
</ol>
<h2 id="node&#x5B89;&#x88C5;&#xFF1A;">node&#x5B89;&#x88C5;&#xFF1A;</h2>
<p>&#x5B89;&#x88C5;&#x5B8C;<code>nvm</code>&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x5C31;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;<code>nvm</code>&#x6765;&#x5B89;&#x88C5;<code>node</code>&#x4E86;&#x3002;&#x6839;&#x636E;&#x5C0F;&#x7A0B;&#x5E8F;&#x4E2D;&#xFF0C;&#x4E91;&#x51FD;&#x6570;&#x4F7F;&#x7528;&#x7684;<code>node.js</code>&#x7248;&#x672C;&#xFF0C;&#x6765;&#x9009;&#x62E9;&#x4F60;&#x8981;&#x5B89;&#x88C5;&#x7684;&#x7248;&#x672C;&#x3002;&#x56E0;&#x4E3A;&#x76EE;&#x524D;&#x6211;&#x7684;&#x4E91;&#x51FD;&#x6570;&#x7528;&#x5230;&#x7684;<code>node.js</code>&#x7248;&#x672C;&#x662F;<code>8.9.0</code>&#xFF0C;&#x56E0;&#x6B64;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x5B89;&#x88C5;<code>8.9.0</code>&#x7248;&#x672C;&#x7684;&#x7684;<code>node.js</code>&#x5C31;&#x53EF;&#x4EE5;&#x3002;&#x5B89;&#x88C5;&#x547D;&#x4EE4;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-shell">nvm install 6.4.0
</code></pre>
<p>&#x5982;&#x679C;&#x4F60;&#x7684;&#x7F51;&#x7EDC;&#x591F;&#x5FEB;&#xFF0C;&#x90A3;&#x4EE5;&#x4E0A;&#x547D;&#x4EE4;&#x5728;&#x7A0D;&#x7B49;&#x7247;&#x523B;&#x4E4B;&#x540E;&#x4F1A;&#x5B89;&#x88C5;&#x6210;&#x529F;&#x3002;&#x5982;&#x679C;&#x4F60;&#x7684;&#x7F51;&#x901F;&#x5F88;&#x6162;&#xFF0C;&#x90A3;&#x4EE5;&#x4E0A;&#x547D;&#x4EE4;&#x53EF;&#x80FD;&#x4F1A;&#x53D1;&#x751F;&#x8D85;&#x65F6;&#x3002;&#x56E0;&#x4E3A;<code>node</code>&#x7684;&#x670D;&#x52A1;&#x5668;&#x5730;&#x5740;&#x662F;<code>https://nodejs.org/dist/</code>&#xFF0C;&#x8FD9;&#x4E2A;&#x57DF;&#x540D;&#x7684;&#x670D;&#x52A1;&#x5668;&#x662F;&#x5728;&#x56FD;&#x5916;&#x3002;&#x56E0;&#x6B64;&#x4F1A;&#x6BD4;&#x8F83;&#x6162;&#x3002;&#x56E0;&#x6B64;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x8BBE;&#x7F6E;&#x4E00;&#x4E0B;<code>nvm</code>&#x7684;&#x6E90;&#x3002;</p>
<pre><code class="lang-shell">nvm node_mirror https://npm.taobao.org/mirrors/node/
nvm npm_mirror https://npm.taobao.org/mirrors/npm/
</code></pre>
<h2 id="npm&#xFF1A;">npm&#xFF1A;</h2>
<p><code>npm(Node Package Manager)</code>&#x5728;&#x5B89;&#x88C5;<code>node</code>&#x7684;&#x65F6;&#x5019;&#x5C31;&#x4F1A;&#x81EA;&#x52A8;&#x7684;&#x5B89;&#x88C5;&#x4E86;&#x3002;&#x5F53;&#x65F6;&#x524D;&#x63D0;&#x6761;&#x4EF6;&#x662F;&#x4F60;&#x9700;&#x8981;&#x8BBE;&#x7F6E;&#x5F53;&#x524D;&#x7684;<code>node</code>&#x7684;&#x7248;&#x672C;&#xFF1A;<code>nvm use 8.9.0</code>&#x3002;&#x7136;&#x540E;&#x5C31;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>npm</code>&#x4E86;.<br>&#x5173;&#x4E8E;<code>npm</code>&#x5E38;&#x7528;&#x547D;&#x4EE4;&#x4EE5;&#x53CA;&#x7528;&#x6CD5;&#xFF0C;&#x8BF7;&#x770B;&#x4E0B;&#x6587;&#x3002;</p>
<h3 id="&#x5B89;&#x88C5;&#x5305;&#xFF1A;">&#x5B89;&#x88C5;&#x5305;&#xFF1A;</h3>
<p>&#x5B89;&#x88C5;&#x5305;&#x5206;&#x4E3A;&#x5168;&#x5C40;&#x5B89;&#x88C5;&#x548C;&#x672C;&#x5730;&#x5B89;&#x88C5;&#x3002;&#x5168;&#x5C40;&#x5B89;&#x88C5;&#x662F;&#x5B89;&#x88C5;&#x5728;&#x5F53;&#x524D;<code>node</code>&#x73AF;&#x5883;&#x4E2D;&#xFF0C;&#x5728;&#x53EF;&#x4EE5;&#x5728;cmd&#x4E2D;&#x5F53;&#x4F5C;&#x547D;&#x4EE4;&#x4F7F;&#x7528;&#x3002;&#x800C;&#x672C;&#x5730;&#x5B89;&#x88C5;&#x662F;&#x5B89;&#x88C5;&#x5728;&#x5F53;&#x524D;&#x9879;&#x76EE;&#x4E2D;&#xFF0C;&#x53EA;&#x6709;&#x5F53;&#x524D;&#x8FD9;&#x4E2A;&#x9879;&#x76EE;&#x80FD;&#x4F7F;&#x7528;&#xFF0C;&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;require&#x5F15;&#x7528;&#x3002;&#x5B89;&#x88C5;&#x7684;&#x65B9;&#x5F0F;&#x53EA;&#x6709;<code>-g</code>&#x53C2;&#x6570;&#x7684;&#x533A;&#x522B;&#xFF1A;</p>
<pre><code class="lang-shell">npm install express          # &#x672C;&#x5730;&#x5B89;&#x88C5;
npm install express -g   # &#x5168;&#x5C40;&#x5B89;&#x88C5;
</code></pre>
<h4 id="&#x672C;&#x5730;&#x5B89;&#x88C5;">&#x672C;&#x5730;&#x5B89;&#x88C5;</h4>
<ol>
<li>&#x5C06;&#x5B89;&#x88C5;&#x5305;&#x653E;&#x5728;<code>./node_modules</code>&#x4E0B;&#xFF08;&#x8FD0;&#x884C; npm &#x547D;&#x4EE4;&#x65F6;&#x6240;&#x5728;&#x7684;&#x76EE;&#x5F55;&#xFF09;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;<code>node_modules</code>&#x76EE;&#x5F55;&#xFF0C;&#x4F1A;&#x5728;&#x5F53;&#x524D;&#x6267;&#x884C;<code>npm</code>&#x547D;&#x4EE4;&#x7684;&#x76EE;&#x5F55;&#x4E0B;&#x751F;&#x6210;<code>node_modules</code>&#x76EE;&#x5F55;&#x3002;</li>
<li>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;<code>require()</code>&#x6765;&#x5F15;&#x5165;&#x672C;&#x5730;&#x5B89;&#x88C5;&#x7684;&#x5305;&#x3002;</li>
</ol>
<h4 id="&#x5168;&#x5C40;&#x5B89;&#x88C5;">&#x5168;&#x5C40;&#x5B89;&#x88C5;</h4>
<ol>
<li>&#x5C06;&#x5B89;&#x88C5;&#x5305;&#x653E;&#x5728;<code>/usr/local</code>&#x4E0B;&#x6216;&#x8005;&#x4F60;<code>node</code>&#x7684;&#x5B89;&#x88C5;&#x76EE;&#x5F55;&#x3002;</li>
<li>&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x5728;&#x547D;&#x4EE4;&#x884C;&#x91CC;&#x4F7F;&#x7528;&#x3002;</li>
</ol>
<h3 id="&#x5378;&#x8F7D;&#x5305;&#xFF1A;">&#x5378;&#x8F7D;&#x5305;&#xFF1A;</h3>
<pre><code class="lang-shell">npm uninstall [package]
</code></pre>
<h3 id="&#x66F4;&#x65B0;&#x5305;&#xFF1A;">&#x66F4;&#x65B0;&#x5305;&#xFF1A;</h3>
<pre><code class="lang-shell">npm update [package]
</code></pre>
<h3 id="&#x641C;&#x7D22;&#x5305;&#xFF1A;">&#x641C;&#x7D22;&#x5305;&#xFF1A;</h3>
<pre><code class="lang-shell">npm search [package]
</code></pre>
<h3 id="&#x4F7F;&#x7528;&#x6DD8;&#x5B9D;&#x955C;&#x50CF;&#xFF1A;">&#x4F7F;&#x7528;&#x6DD8;&#x5B9D;&#x955C;&#x50CF;&#xFF1A;</h3>
<p>npm install -g cnpm --registry=<a href="https://registry.npm.taobao.org" target="_blank">https://registry.npm.taobao.org</a>
&#x90A3;&#x4E48;&#x4EE5;&#x540E;&#x5C31;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;cnpm&#x6765;&#x5B89;&#x88C5;&#x5305;&#x4E86;&#xFF01;</p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="./di-ba-jie-ff1a-wen-jian-shang-chuan.html" class="navigation navigation-prev " aria-label="Previous page: 第八节：文件操作"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="./di-shi-jie-ff1a-yun-han-shu.html" class="navigation navigation-next " aria-label="Next page: 第十节：云函数"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/app.js"></script>

    
    <script src="gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
